import axios from 'axios';
const http_data = axios.create({
  baseURL: 'http://localhost:8000',
  timeout: 3000,
});
http_data.interceptors.request.use(
  (config) => {
    // 请求拦截器
    return config;
  },
  (error) => {
    console.log('请求失败', error);
    return Promise.reject(error);
  }
);
http_data.interceptors.response.use(
  (res) => {
    if (res.status === 200) {
      return res.data;
    } else {
      Promise.reject();
    }
  },
  (error) => {
    console.log('响应失败', error);
    return Promise.reject(error);
  }
);
export default http_data;
